home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Prg / WAVPLUS.ZIP / MCIWAV.WD_ / MCIWAV.WD
Text File  |  1997-09-14  |  28KB  |  919 lines

  1. VERSION 2.00
  2. Begin Form MCIwav 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "MCI WAV Player"
  6.    ClientHeight    =   6225
  7.    ClientLeft      =   1200
  8.    ClientTop       =   795
  9.    ClientWidth     =   4470
  10.    ControlBox      =   0   'False
  11.    Height          =   6630
  12.    Left            =   1140
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   6225
  17.    ScaleWidth      =   4470
  18.    Top             =   450
  19.    Width           =   4590
  20.    Begin CommandButton CmdEraseToEnd 
  21.       BackColor       =   &H00C0C0C0&
  22.       Caption         =   "Erase ->"
  23.       Height          =   375
  24.       Left            =   240
  25.       TabIndex        =   9
  26.       Top             =   5640
  27.       Width           =   1335
  28.    End
  29.    Begin CommandButton CmdEraseToStart 
  30.       BackColor       =   &H00C0C0C0&
  31.       Caption         =   "<- Erase"
  32.       Height          =   375
  33.       Left            =   240
  34.       TabIndex        =   8
  35.       Top             =   5280
  36.       Width           =   1335
  37.    End
  38.    Begin CommandButton CmdEraseAll 
  39.       BackColor       =   &H00C0C0C0&
  40.       Caption         =   "Erase All"
  41.       Height          =   375
  42.       Left            =   240
  43.       TabIndex        =   7
  44.       Top             =   4920
  45.       Width           =   1335
  46.    End
  47.    Begin CommandButton CmdUndo 
  48.       BackColor       =   &H00C0C0C0&
  49.       Caption         =   "Undo"
  50.       Height          =   375
  51.       Left            =   2880
  52.       TabIndex        =   13
  53.       Top             =   4920
  54.       Width           =   1335
  55.    End
  56.    Begin CommandButton CmdSave 
  57.       BackColor       =   &H00C0C0C0&
  58.       Caption         =   "Save Wav"
  59.       Height          =   375
  60.       Left            =   2880
  61.       TabIndex        =   15
  62.       Top             =   5640
  63.       Width           =   1335
  64.    End
  65.    Begin CommandButton CmdAddToStart 
  66.       BackColor       =   &H00C0C0C0&
  67.       Caption         =   "Add To Start"
  68.       Height          =   375
  69.       Left            =   1560
  70.       TabIndex        =   11
  71.       Top             =   5280
  72.       Width           =   1335
  73.    End
  74.    Begin CommandButton CmdNewWav 
  75.       BackColor       =   &H00C0C0C0&
  76.       Caption         =   "Begin New"
  77.       Height          =   375
  78.       Left            =   2880
  79.       TabIndex        =   14
  80.       Top             =   5280
  81.       Width           =   1335
  82.    End
  83.    Begin CommandButton CmdAddToEnd 
  84.       BackColor       =   &H00C0C0C0&
  85.       Caption         =   "Add To End"
  86.       Height          =   375
  87.       Left            =   1560
  88.       TabIndex        =   12
  89.       Top             =   5640
  90.       Width           =   1335
  91.    End
  92.    Begin CommandButton CmdInsertAt 
  93.       BackColor       =   &H00C0C0C0&
  94.       Caption         =   "Insert At"
  95.       Height          =   375
  96.       Left            =   1560
  97.       TabIndex        =   10
  98.       Top             =   4920
  99.       Width           =   1335
  100.    End
  101.    Begin Timer Timer1 
  102.       Interval        =   50
  103.       Left            =   120
  104.       Top             =   960
  105.    End
  106.    Begin CommandButton CmdStop 
  107.       BackColor       =   &H00C0C0C0&
  108.       Caption         =   "&Stop"
  109.       Height          =   375
  110.       Left            =   2880
  111.       TabIndex        =   4
  112.       Top             =   3480
  113.       Width           =   1335
  114.    End
  115.    Begin CommandButton CmdToEnd 
  116.       BackColor       =   &H00C0C0C0&
  117.       Caption         =   "To &End"
  118.       Height          =   375
  119.       Left            =   1560
  120.       TabIndex        =   3
  121.       Top             =   3840
  122.       Width           =   1335
  123.    End
  124.    Begin CommandButton CmdToStart 
  125.       BackColor       =   &H00C0C0C0&
  126.       Caption         =   "To S&tart"
  127.       Height          =   375
  128.       Left            =   1560
  129.       TabIndex        =   2
  130.       Top             =   3480
  131.       Width           =   1335
  132.    End
  133.    Begin CommandButton CmdPause 
  134.       BackColor       =   &H00C0C0C0&
  135.       Caption         =   "P&ause"
  136.       Height          =   375
  137.       Left            =   240
  138.       TabIndex        =   1
  139.       Top             =   3840
  140.       Width           =   1335
  141.    End
  142.    Begin CommandButton CmdPlay 
  143.       BackColor       =   &H00C0C0C0&
  144.       Caption         =   "&Play"
  145.       Height          =   375
  146.       Left            =   240
  147.       TabIndex        =   0
  148.       Top             =   3480
  149.       Width           =   1335
  150.    End
  151.    Begin HScrollBar HScroll1 
  152.       Height          =   255
  153.       LargeChange     =   10
  154.       Left            =   240
  155.       TabIndex        =   6
  156.       Top             =   3000
  157.       Width           =   3975
  158.    End
  159.    Begin CommandButton CmdOkay 
  160.       BackColor       =   &H00C0C0C0&
  161.       Cancel          =   -1  'True
  162.       Caption         =   "O &K A Y"
  163.       Height          =   375
  164.       Left            =   2880
  165.       TabIndex        =   5
  166.       Top             =   3840
  167.       Width           =   1335
  168.    End
  169.    Begin Label Label4 
  170.       Alignment       =   2  'Center
  171.       BackColor       =   &H00C0C0C0&
  172.       Caption         =   "WAV Record Options:"
  173.       Height          =   200
  174.       Left            =   240
  175.       TabIndex        =   33
  176.       Top             =   4560
  177.       Width           =   3975
  178.    End
  179.    Begin Line Line1 
  180.       BorderWidth     =   2
  181.       X1              =   240
  182.       X2              =   4200
  183.       Y1              =   4440
  184.       Y2              =   4440
  185.    End
  186.    Begin Label Label7 
  187.       BackColor       =   &H00C0C0C0&
  188.       Caption         =   "Label7"
  189.       Height          =   195
  190.       Index           =   6
  191.       Left            =   2400
  192.       TabIndex        =   32
  193.       Top             =   1680
  194.       Width           =   1815
  195.    End
  196.    Begin Label Label6 
  197.       Alignment       =   1  'Right Justify
  198.       BackColor       =   &H00C0C0C0&
  199.       Caption         =   "WAV Length (bytes):"
  200.       Height          =   195
  201.       Index           =   6
  202.       Left            =   240
  203.       TabIndex        =   31
  204.       Top             =   1680
  205.       Width           =   1935
  206.    End
  207.    Begin Label Label7 
  208.       BackColor       =   &H00C0C0C0&
  209.       Caption         =   "Label7"
  210.       ForeColor       =   &H00000080&
  211.       Height          =   195
  212.       Index           =   5
  213.       Left            =   2400
  214.       TabIndex        =   30
  215.       Top             =   2520
  216.       Width           =   1815
  217.    End
  218.    Begin Label Label6 
  219.       Alignment       =   1  'Right Justify
  220.       BackColor       =   &H00C0C0C0&
  221.       Caption         =   "Percent Played:"
  222.       ForeColor       =   &H00000080&
  223.       Height          =   195
  224.       Index           =   5
  225.       Left            =   240
  226.       TabIndex        =   29
  227.       Top             =   2520
  228.       Width           =   1935
  229.    End
  230.    Begin Label Label7 
  231.       BackColor       =   &H00C0C0C0&
  232.       Caption         =   "Label7"
  233.       ForeColor       =   &H00000080&
  234.       Height          =   195
  235.       Index           =   4
  236.       Left            =   2400
  237.       TabIndex        =   19
  238.       Top             =   2280
  239.       Width           =   1815
  240.    End
  241.    Begin Label Label7 
  242.       BackColor       =   &H00C0C0C0&
  243.       Caption         =   "Label7"
  244.       Height          =   195
  245.       Index           =   3
  246.       Left            =   2400
  247.       TabIndex        =   20
  248.       Top             =   1920
  249.       Width           =   1815
  250.    End
  251.    Begin Label Label7 
  252.       BackColor       =   &H00C0C0C0&
  253.       BackStyle       =   0  'Transparent
  254.       Caption         =   "Label7"
  255.       Height          =   195
  256.       Index           =   2
  257.       Left            =   2400
  258.       TabIndex        =   28
  259.       Top             =   1440
  260.       Width           =   1815
  261.    End
  262.    Begin Label Label7 
  263.       BackColor       =   &H00C0C0C0&
  264.       BackStyle       =   0  'Transparent
  265.       Caption         =   "Label7"
  266.       Height          =   195
  267.       Index           =   1
  268.       Left            =   2400
  269.       TabIndex        =   27
  270.       Top             =   1200
  271.       Width           =   1815
  272.    End
  273.    Begin Label Label7 
  274.       BackColor       =   &H00C0C0C0&
  275.       BackStyle       =   0  'Transparent
  276.       Caption         =   "Label7"
  277.       Height          =   195
  278.       Index           =   0
  279.       Left            =   2400
  280.       TabIndex        =   26
  281.       Top             =   960
  282.       Width           =   1815
  283.    End
  284.    Begin Label Label6 
  285.       Alignment       =   1  'Right Justify
  286.       BackColor       =   &H00C0C0C0&
  287.       Caption         =   "Current Position (ms):"
  288.       ForeColor       =   &H00000080&
  289.       Height          =   195
  290.       Index           =   4
  291.       Left            =   240
  292.       TabIndex        =   25
  293.       Top             =   2280
  294.       Width           =   1935
  295.    End
  296.    Begin Label Label6 
  297.       Alignment       =   1  'Right Justify
  298.       BackColor       =   &H00C0C0C0&
  299.       Caption         =   "WAV Length (ms):"
  300.       Height          =   195
  301.       Index           =   3
  302.       Left            =   240
  303.       TabIndex        =   24
  304.       Top             =   1920
  305.       Width           =   1935
  306.    End
  307.    Begin Label Label6 
  308.       Alignment       =   1  'Right Justify
  309.       BackStyle       =   0  'Transparent
  310.       Caption         =   "Sample Rate:"
  311.       Height          =   195
  312.       Index           =   2
  313.       Left            =   240
  314.       TabIndex        =   23
  315.       Top             =   1440
  316.       Width           =   1935
  317.    End
  318.    Begin Label Label6 
  319.       Alignment       =   1  'Right Justify
  320.       BackStyle       =   0  'Transparent
  321.       Caption         =   "Channels:"
  322.       Height          =   195
  323.       Index           =   1
  324.       Left            =   240
  325.       TabIndex        =   22
  326.       Top             =   1200
  327.       Width           =   1935
  328.    End
  329.    Begin Label Label6 
  330.       Alignment       =   1  'Right Justify
  331.       BackStyle       =   0  'Transparent
  332.       Caption         =   "Bit Size:"
  333.       Height          =   195
  334.       Index           =   0
  335.       Left            =   240
  336.       TabIndex        =   21
  337.       Top             =   960
  338.       Width           =   1935
  339.    End
  340.    Begin Label Label3 
  341.       BackColor       =   &H00C0C0C0&
  342.       Caption         =   "Label3"
  343.       ForeColor       =   &H00800000&
  344.       Height          =   195
  345.       Left            =   2400
  346.       TabIndex        =   18
  347.       Top             =   600
  348.       Width           =   1815
  349.    End
  350.    Begin Label Label2 
  351.       Alignment       =   1  'Right Justify
  352.       BackColor       =   &H00C0C0C0&
  353.       Caption         =   "WAV mode:"
  354.       ForeColor       =   &H00800000&
  355.       Height          =   195
  356.       Left            =   240
  357.       TabIndex        =   17
  358.       Top             =   600
  359.       Width           =   1935
  360.    End
  361.    Begin Label Label1 
  362.       Alignment       =   2  'Center
  363.       BackColor       =   &H00C0C0C0&
  364.       Caption         =   "Label1"
  365.       Height          =   195
  366.       Left            =   240
  367.       TabIndex        =   16
  368.       Top             =   240
  369.       Width           =   3975
  370.    End
  371. End
  372. Dim nl As String
  373. Dim Recorded As Integer
  374. Dim FirstNew As Integer
  375.  
  376. Dim FirstTime As Integer
  377.  
  378. Sub CmdAddToEnd_Click ()
  379.     If HowManyWavRecordDevices() = 0 Then
  380.         MsgBox "Sound card can not record!", 16, "Device Error"
  381.         Exit Sub
  382.         End If
  383.     msg$ = "This option will begin inserting the" + nl
  384.     msg$ = msg$ + "recording at the END of the file!"
  385.     response = MsgBox(msg$, 33, "Record Add To End")
  386.     If response = 2 Then Exit Sub
  387.     
  388.     CmdToEnd_Click
  389.     CmdAddToEnd.Enabled = False
  390.     CmdInsertAt.Enabled = False
  391.     CmdNewWav.Enabled = False
  392.     CmdOkay.Enabled = False
  393.     CmdPause.Enabled = False
  394.     CmdPlay.Enabled = False
  395.     CmdAddToStart.Enabled = False
  396.     CmdSave.Enabled = False
  397.     CmdToEnd.Enabled = False
  398.     CmdToStart.Enabled = False
  399.     CmdEraseAll.Enabled = False
  400.     CmdEraseToEnd.Enabled = False
  401.     CmdEraseToStart.Enabled = False
  402.     CmdUndo.Enabled = False
  403.     HScroll1.Enabled = False
  404.     Label6(4).Visible = False
  405.     Label7(4).Visible = False
  406.     Label6(5).Visible = False
  407.     Label7(5).Visible = False
  408.     Label6(3).ForeColor = QBColor(4)
  409.     Label7(3).ForeColor = QBColor(4)
  410.     Label6(6).ForeColor = QBColor(4)
  411.     Label7(6).ForeColor = QBColor(4)
  412.     Recorded = True
  413.  
  414.     Answer$ = Space$(255)
  415.     WavRecord Answer$
  416.     If Left$(Answer$, 1) <> Chr$(0) Then
  417.         MsgBox "Incompatible file format!", 16, "File Error"
  418.         Recorded = False
  419.         CmdStop_Click
  420.         End If
  421. End Sub
  422.  
  423. Sub CmdAddToStart_Click ()
  424.     If HowManyWavRecordDevices() = 0 Then
  425.         MsgBox "Sound card can not record!", 16, "Device Error"
  426.         Exit Sub
  427.         End If
  428.     msg$ = "This option will begin inserting the" + nl
  429.     msg$ = msg$ + "recording at the START of the file!"
  430.     response = MsgBox(msg$, 33, "Record Add To Start")
  431.     If response = 2 Then Exit Sub
  432.     
  433.     CmdToStart_Click
  434.     CmdAddToEnd.Enabled = False
  435.     CmdInsertAt.Enabled = False
  436.     CmdNewWav.Enabled = False
  437.     CmdOkay.Enabled = False
  438.     CmdPause.Enabled = False
  439.     CmdPlay.Enabled = False
  440.     CmdAddToStart.Enabled = False
  441.     CmdSave.Enabled = False
  442.     CmdToEnd.Enabled = False
  443.     CmdToStart.Enabled = False
  444.     CmdEraseAll.Enabled = False
  445.     CmdEraseToEnd.Enabled = False
  446.     CmdEraseToStart.Enabled = False
  447.     CmdUndo.Enabled = False
  448.     HScroll1.Enabled = False
  449.     Label6(4).Visible = False
  450.     Label7(4).Visible = False
  451.     Label6(5).Visible = False
  452.     Label7(5).Visible = False
  453.     Label6(3).ForeColor = QBColor(4)
  454.     Label7(3).ForeColor = QBColor(4)
  455.     Label6(6).ForeColor = QBColor(4)
  456.     Label7(6).ForeColor = QBColor(4)
  457.     Recorded = True
  458.  
  459.     Answer$ = Space$(255)
  460.     WavRecord Answer$
  461.     If Left$(Answer$, 1) <> Chr$(0) Then
  462.         MsgBox "Incompatible file format!", 16, "File Error"
  463.         Recorded = False
  464.         CmdStop_Click
  465.         End If
  466. End Sub
  467.  
  468. Sub CmdEraseAll_Click ()
  469.     If HowManyWavRecordDevices() = 0 Then
  470.         MsgBox "Sound card can not record!", 16, "Device Error"
  471.         Exit Sub
  472.         End If
  473.     msg$ = "This option will ERASE the" + nl
  474.     msg$ = msg$ + "entire Wav file contents!"
  475.     response = MsgBox(msg$, 33, "Erase All")
  476.     If response = 2 Then Exit Sub
  477.     
  478.     Recorded = True
  479.     Screen.MousePointer = 11
  480.     Answer$ = Space$(255)
  481.     WavEraseAll Answer$
  482.     CmdStop_Click
  483.     Screen.MousePointer = 0
  484. End Sub
  485.  
  486. Sub CmdEraseToEnd_Click ()
  487.     If HowManyWavRecordDevices() = 0 Then
  488.         MsgBox "Sound card can not record!", 16, "Device Error"
  489.         Exit Sub
  490.         End If
  491.     msg$ = "This option will ERASE the Wav file from" + nl
  492.     msg$ = msg$ + "the current position to the END of the file!"
  493.     response = MsgBox(msg$, 33, "Erase To End")
  494.     If response = 2 Then Exit Sub
  495.     
  496.     Recorded = True
  497.     Screen.MousePointer = 11
  498.     Answer$ = Space$(255)
  499.     WavStatusPosition Answer$
  500.     SecStart$ = Trim$(Str$(Val(Answer$)))
  501.     Answer$ = Space$(255)
  502.     WavStatusLengthMS Answer$
  503.     SecEnd$ = Trim$(Str$(Val(Answer$)))
  504.     Answer$ = Space$(255)
  505.     WavEraseSection SecStart$, SecEnd$, Answer$
  506.     CmdStop_Click
  507.     Screen.MousePointer = 0
  508. End Sub
  509.  
  510. Sub CmdEraseToStart_Click ()
  511.     If HowManyWavRecordDevices() = 0 Then
  512.         MsgBox "Sound card can not record!", 16, "Device Error"
  513.         Exit Sub
  514.         End If
  515.     msg$ = "This option will ERASE the Wav file from" + nl
  516.     msg$ = msg$ + "the current position to the START of the file!"
  517.     response = MsgBox(msg$, 33, "Erase To Start")
  518.     If response = 2 Then Exit Sub
  519.     
  520.     Recorded = True
  521.     Screen.MousePointer = 11
  522.     SecStart$ = "0"
  523.     Answer$ = Space$(255)
  524.     WavStatusPosition Answer$
  525.     SecEnd$ = Trim$(Str$(Val(Answer$)))
  526.     Answer$ = Space$(255)
  527.     WavEraseSection SecStart$, SecEnd$, Answer$
  528.     CmdStop_Click
  529.     Screen.MousePointer = 0
  530. End Sub
  531.  
  532. Sub CmdInsertAt_Click ()
  533.     If HowManyWavRecordDevices() = 0 Then
  534.         MsgBox "Sound card can not record!", 16, "Device Error"
  535.         Exit Sub
  536.         End If
  537.     msg$ = "This option will begin inserting the" + nl
  538.     msg$ = msg$ + "recording at the CURRENT POSITION!"
  539.     response = MsgBox(msg$, 33, "Record Insert At")
  540.     If response = 2 Then Exit Sub
  541.     
  542.     CmdAddToEnd.Enabled = False
  543.     CmdInsertAt.Enabled = False
  544.     CmdNewWav.Enabled = False
  545.     CmdOkay.Enabled = False
  546.     CmdPause.Enabled = False
  547.     CmdPlay.Enabled = False
  548.     CmdAddToStart.Enabled = False
  549.     CmdSave.Enabled = False
  550.     CmdToEnd.Enabled = False
  551.     CmdToStart.Enabled = False
  552.     CmdEraseAll.Enabled = False
  553.     CmdEraseToEnd.Enabled = False
  554.     CmdEraseToStart.Enabled = False
  555.     CmdUndo.Enabled = False
  556.     HScroll1.Enabled = False
  557.     Label6(4).Visible = False
  558.     Label7(4).Visible = False
  559.     Label6(5).Visible = False
  560.     Label7(5).Visible = False
  561.     Label6(3).ForeColor = QBColor(4)
  562.     Label7(3).ForeColor = QBColor(4)
  563.     Label6(6).ForeColor = QBColor(4)
  564.     Label7(6).ForeColor = QBColor(4)
  565.     Recorded = True
  566.  
  567.     Answer$ = Space$(255)
  568.     WavRecord Answer$
  569.     If Left$(Answer$, 1) <> Chr$(0) Then
  570.         MsgBox "Incompatible file format!", 16, "File Error"
  571.         Recorded = False
  572.         CmdStop_Click
  573.         End If
  574. End Sub
  575.  
  576. Sub CmdNewWav_Click ()
  577.     If HowManyWavRecordDevices() = 0 Then
  578.         MsgBox "Sound card can not record!", 16, "Device Error"
  579.         Exit Sub
  580.         End If
  581.     If Recorded = True Then
  582.         msg$ = "The Wav file changes have not been" + nl
  583.         msg$ = msg$ + "saved.  Do you want to save now?"
  584.         response = MsgBox(msg$, 36, "Exit WAV Storage Warning")
  585.         If response = 6 Then Exit Sub
  586.         End If
  587.     
  588.     msg$ = "This option will create a new Wav file." + nl
  589.     msg$ = msg$ + "You may record after entering a name."
  590.     response = MsgBox(msg$, 33, "Begin New")
  591.     If response = 2 Then Exit Sub
  592.     Screen.MousePointer = 11
  593.     WavName.Show 1
  594.     If FormPassString2 = "" Then Exit Sub
  595.     
  596.     Screen.MousePointer = 11
  597.     Me.Refresh
  598.     FormPassString = FormPassString2
  599.     Answer$ = Space$(255)
  600.     WavClose Answer$
  601.     Answer$ = Space$(255)
  602.     WavOpenNew Answer$
  603.     
  604.     Answer$ = Space$(255)
  605.     lpValue$ = "8"
  606.     WavSetBitSize lpValue$, Answer$
  607.     Answer$ = Space$(255)
  608.     lpValue$ = "1"
  609.     WavSetChannels lpValue$, Answer$
  610.     Answer$ = Space$(255)
  611.     lpValue$ = "11025"
  612.     WavSetSampleRate lpValue$, Answer$
  613.     
  614.     Answer$ = Space$(255)
  615.     WavStatusBitSize Answer$
  616.     Label7(0).Caption = Answer$
  617.     Answer$ = Space$(255)
  618.     WavStatusChannels Answer$
  619.     If Val(Answer$) = 1 Then
  620.         Answer$ = "mono"
  621.         Else
  622.         Answer$ = "stereo"
  623.         End If
  624.     Label7(1).Caption = Answer$
  625.     Answer$ = Space$(255)
  626.     WavStatusSampleRate Answer$
  627.     Label7(2).Caption = Format$(Val(Answer$), "###,##0") + " Hz"
  628.  
  629.     Answer$ = Space$(255)
  630.     WavStatusLengthMS Answer$
  631.     Label7(3).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  632.     Answer$ = Space$(255)
  633.     WavStatusLengthBytes Answer$
  634.     Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  635.     
  636.     TempName$ = FormPassString
  637.     RevString TempName$
  638.     pos% = InStr(TempName$, "\")
  639.     TempName$ = Left$(TempName$, pos% - 1)
  640.     RevString TempName$
  641.     Label1.Caption = UCase$(TempName$)
  642.  
  643.     CmdStop_Click
  644.     Screen.MousePointer = 0
  645.  
  646.     Recorded = True
  647.     FirstNew = True
  648. End Sub
  649.  
  650. Sub CmdOkay_Click ()
  651.     Answer$ = Space$(255)
  652.     WavClose Answer$
  653.     Unload Me
  654. End Sub
  655.  
  656. Sub CmdPause_Click ()
  657.     Answer$ = Space$(255)
  658.     WavPause Answer$
  659. End Sub
  660.  
  661. Sub CmdPlay_Click ()
  662.     Answer$ = Space$(255)
  663.     WavStatusLengthMS Answer$
  664.     MSlength% = Val(Answer$)
  665.     If MSlength% = 0 Then
  666.         MsgBox "The Wav file is empty!", 16, "User Error"
  667.         Exit Sub
  668.         End If
  669.     Answer$ = Space$(255)
  670.     WavStart Answer$
  671.     If Left$(Answer$, 1) <> Chr$(0) Then
  672.         MsgBox "Incompatible file format!", 16, "File Error"
  673.         End If
  674. End Sub
  675.  
  676. Sub CmdSave_Click ()
  677.     If HowManyWavRecordDevices() = 0 Then
  678.         MsgBox "Sound card can not record!", 16, "Device Error"
  679.         Exit Sub
  680.         End If
  681.     If Recorded = False Then
  682.         MsgBox "No changes to save!", 16, "User Error"
  683.         Exit Sub
  684.         End If
  685.     Answer$ = Space$(255)
  686.     WavStatusLengthMS Answer$
  687.     MSlength% = Val(Answer$)
  688.     If MSlength% = 0 Then
  689.         MsgBox "Can not save an empty file!", 16, "User Error"
  690.         Exit Sub
  691.         End If
  692.  
  693.     Screen.MousePointer = 11
  694.     Answer$ = Space$(255)
  695.     WavSave FormPassString, Answer$
  696.     If FirstNew = True Then
  697.         FirstNew = False
  698.         Else
  699.         Answer$ = Space$(255)
  700.         WavSave FormPassString, Answer$
  701.         End If
  702.     Recorded = False
  703.     WavPlay.File1.Pattern = "abcdefgh.zyx"
  704.     WavPlay.File1.Pattern = "*.WAV"
  705.     Screen.MousePointer = 0
  706. End Sub
  707.  
  708. Sub CmdStop_Click ()
  709.     Answer$ = Space$(255)
  710.     WavStop Answer$
  711.     
  712.     Answer$ = Space$(255)
  713.     WavStatusLengthMS Answer$
  714.     Label7(3).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  715.     HScroll1.Max = Val(Answer$)
  716.     Answer$ = Space$(255)
  717.     WavStatusLengthBytes Answer$
  718.     Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  719.     
  720.     CmdAddToEnd.Enabled = True
  721.     CmdInsertAt.Enabled = True
  722.     CmdNewWav.Enabled = True
  723.     CmdOkay.Enabled = True
  724.     CmdPause.Enabled = True
  725.     CmdPlay.Enabled = True
  726.     CmdAddToStart.Enabled = True
  727.     CmdSave.Enabled = True
  728.     CmdToEnd.Enabled = True
  729.     CmdToStart.Enabled = True
  730.     CmdEraseAll.Enabled = True
  731.     CmdEraseToEnd.Enabled = True
  732.     CmdEraseToStart.Enabled = True
  733.     CmdUndo.Enabled = True
  734.     HScroll1.Enabled = True
  735.     Label6(4).Visible = True
  736.     Label7(4).Visible = True
  737.     Label6(5).Visible = True
  738.     Label7(5).Visible = True
  739.     Label6(3).ForeColor = QBColor(0)
  740.     Label7(3).ForeColor = QBColor(0)
  741.     Label6(6).ForeColor = QBColor(0)
  742.     Label7(6).ForeColor = QBColor(0)
  743.  
  744.     Answer$ = Space$(255)
  745.     WavSeekStart Answer$
  746.     Answer$ = Space$(255)
  747.     WavStatusPosition Answer$
  748.     position% = Val(Answer$)
  749.     Label7(4).Caption = Format$(position%, "###,##0") + " ms"
  750.     DoPercent
  751.     HScroll1.Value = position%
  752. End Sub
  753.  
  754. Sub CmdToEnd_Click ()
  755.     Answer$ = Space$(255)
  756.     WavSeekEnd Answer$
  757.     HScroll1.Value = HScroll1.Max
  758. End Sub
  759.  
  760. Sub CmdToStart_Click ()
  761.     Answer$ = Space$(255)
  762.     WavSeekStart Answer$
  763.     HScroll1.Value = 0
  764. End Sub
  765.  
  766. Sub CmdUndo_Click ()
  767.     If HowManyWavRecordDevices() = 0 Then
  768.         MsgBox "Sound card can not record!", 16, "Device Error"
  769.         Exit Sub
  770.         End If
  771.     If Recorded = False Then
  772.         MsgBox "No changes to undo!", 16, "User Error"
  773.         Exit Sub
  774.         End If
  775.     response = MsgBox("Really undo changes?", 36, "Undo Warning")
  776.     If response = 7 Then Exit Sub
  777.     
  778.     Screen.MousePointer = 11
  779.     Answer$ = Space$(255)
  780.     WavClose Answer$
  781.     Answer$ = Space$(255)
  782.     WavOpen FormPassString, Answer$
  783.     Answer$ = Space$(255)
  784.     WavStatusLengthMS Answer$
  785.     Label7(3).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  786.     Answer$ = Space$(255)
  787.     WavStatusLengthBytes Answer$
  788.     Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  789.     Recorded = False
  790.     CmdStop_Click
  791.     Screen.MousePointer = 0
  792. End Sub
  793.  
  794. Sub DoPercent ()
  795.     If HScroll1.Max = 0 Then
  796.         Percent$ = "0%"
  797.         Else
  798.         Answer$ = Space$(255)
  799.         WavStatusPosition Answer$
  800.         position% = Val(Answer$)
  801.         Percent$ = Format$(Int((position% / HScroll1.Max) * 100), "##0") + "%"
  802.         End If
  803.     Label7(5).Caption = Percent$
  804. End Sub
  805.  
  806. Sub Form_Load ()
  807.     FormCenterForm Me, WavPlay
  808.     nl = Chr$(13) + Chr$(10)
  809.     Recorded = False
  810.     FirstNew = False
  811.     FirstTime = True
  812.  
  813.     TempName$ = FormPassString
  814.     RevString TempName$
  815.     pos% = InStr(TempName$, "\")
  816.     TempName$ = Left$(TempName$, pos% - 1)
  817.     RevString TempName$
  818.     Label1.Caption = UCase$(TempName$)
  819.     
  820.     Answer$ = Space$(255)
  821.     WavOpen FormPassString, Answer$
  822.     
  823.     Answer$ = Space$(255)
  824.     WavStatusMode Answer$
  825.     Label3.Caption = UCase$(Answer$)
  826.     Answer$ = Space$(255)
  827.     WavStatusBitSize Answer$
  828.     Label7(0).Caption = Answer$
  829.     Answer$ = Space$(255)
  830.     WavStatusChannels Answer$
  831.     If Val(Answer$) = 1 Then
  832.         Answer$ = "mono"
  833.         Else
  834.         Answer$ = "stereo"
  835.         End If
  836.     Label7(1).Caption = Answer$
  837.     Answer$ = Space$(255)
  838.     WavStatusSampleRate Answer$
  839.     Label7(2).Caption = Format$(Val(Answer$), "###,##0") + " Hz"
  840.     
  841.     Answer$ = Space$(255)
  842.     WavStatusLengthMS Answer$
  843.     Label7(3).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  844.     HScroll1.Max = Val(Answer$)
  845.     Answer$ = Space$(255)
  846.     WavStatusLengthBytes Answer$
  847.     Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  848.  
  849.     Answer$ = Space$(255)
  850.     WavStatusPosition Answer$
  851.     Label7(4).Caption = Format$(Val(Answer$), "###,##0") + " ms"
  852.     HScroll1.Value = Val(Answer$)
  853.     DoPercent
  854.  
  855.     Screen.MousePointer = 0
  856. End Sub
  857.  
  858. Sub Form_Paint ()
  859.     DoForm3D Me, "raised", 2, 0
  860.     DoForm3D Me, "sunken", 2, 2
  861.     DoControl3D Label1, "sunken", 1
  862.     DoControl3D Label2, "sunken", 1
  863.     DoControl3D Label3, "sunken", 1
  864.     DoControl3D Label4, "sunken", 1
  865.     For i = 3 To 6
  866.         DoControl3D Label6(i), "sunken", 1
  867.         DoControl3D Label7(i), "sunken", 1
  868.         Next
  869. End Sub
  870.  
  871. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  872.     If Recorded = True Then
  873.         msg$ = "The Wav file changes have not been" + nl
  874.         msg$ = msg$ + "saved.  Do you want to save now?"
  875.         response = MsgBox(msg$, 36, "Exit WAV Storage Warning")
  876.         If response = 6 Then Cancel = True
  877.         End If
  878. End Sub
  879.  
  880. Sub HScroll1_Change ()
  881.     Answer$ = Space$(255)
  882.     WavStatusMode Answer$
  883.     If Left$(Answer$, 7) <> "playing" Then
  884.         Answer$ = Space$(255)
  885.         NewValue$ = Trim$(Str$(HScroll1.Value))
  886.         WavSeekPosition NewValue$, Answer$
  887.         Answer$ = Space$(255)
  888.         WavStatusPosition Answer$
  889.         position% = Val(Answer$)
  890.         Label7(4).Caption = Format$(position%, "###,##0") + " ms"
  891.         DoPercent
  892.         End If
  893. End Sub
  894.  
  895. Sub Timer1_Timer ()
  896.     Answer$ = Space$(255)
  897.     WavStatusMode Answer$
  898.     Label3.Caption = UCase$(Answer$)
  899.         If Left$(Answer$, 7) = "playing" Then
  900.             Answer$ = Space$(255)
  901.             WavStatusPosition Answer$
  902.             position% = Val(Answer$)
  903.             Label7(4).Caption = Format$(position%, "###,##0") + " ms"
  904.             DoPercent
  905.             HScroll1.Value = position%
  906.             End If
  907.         If Left$(Answer$, 9) = "recording" Then
  908.             Answer$ = Space$(255)
  909.             WavStatusLengthMS Answer$
  910.             MSlength% = Val(Answer$)
  911.             Label7(3).Caption = Format$(MSlength%, "###,##0") + " ms"
  912.             Answer$ = Space$(255)
  913.             WavStatusLengthBytes Answer$
  914.             Label7(6).Caption = Format$(Val(Answer$), "###,##0") + " bytes"
  915.             If MSlength% = 60000 Then CmdStop_Click
  916.             End If
  917. End Sub
  918.  
  919.